package router

import (
	"projorg/controller"

	"github.com/gin-gonic/gin"
)

// MapRouter ...
func MapRouter() *gin.Engine {
	router := gin.Default()
	// 中间件使用，有gin框架自带的，也可以有自定义的
	router.Use(gin.Logger())
	router.GET("/demo", controller.Demo)
	router.GET("/", controller.IndexHandler)
	router.GET("/todo/", controller.ListTodoHandler)
	router.POST("/todo/", controller.AddTodoHandler)
	router.PUT("/todo/:id", controller.UpdateTodoHandler)
	// router.PATCH("/todo/:id", updateTodoHandler)
	router.DELETE("/todo/:id", controller.DeleteTodoHandler)
	router.GET("/todo/:id", controller.GetTodoHandler)
	return router
}
